<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>预定义常量</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="array.resources.html">« 资源类型</a></li>
      <li style="float: right;"><a href="array.sorting.html">对数组进行排序 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.array.html">数组</a></li>
    <li>预定义常量</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="array.constants" class="appendix">
 <h1>预定义常量</h1>

 <p class="simpara">
下列常量作为 PHP 核心的一部分总是可用的。
</p>
 <p class="para">
 <dl>
  
   <dt id="constant.case-lower">
    <strong><code>CASE_LOWER</code></strong>
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
     <strong><code>CASE_LOWER</code></strong> 用在
     <span class="function"><a href="function.array-change-key-case.html" class="function">array_change_key_case()</a></span> 中将数组的键名转换成小写字母。这也是
     <span class="function"><a href="function.array-change-key-case.html" class="function">array_change_key_case()</a></span> 的默认值。从 PHP 8.2.0 开始，只转换 ASCII 字符。
    </span>
   </dd>

  
  
   <dt id="constant.case-upper">
    <strong><code>CASE_UPPER</code></strong>
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
     <strong><code>CASE_UPPER</code></strong> 用在
     <span class="function"><a href="function.array-change-key-case.html" class="function">array_change_key_case()</a></span> 中将数组的键名转换成大写字母。从 PHP 8.2.0 开始，只转换 ASCII 字符。
    </span>
   </dd>

  
 </dl>

 </p>

 <p class="para"> 排序顺序标识：
 <dl>
  
   <dt id="constant.sort-asc">
    <strong><code>SORT_ASC</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
     <strong><code>SORT_ASC</code></strong> 用在 <span class="function"><a href="function.array-multisort.html" class="function">array_multisort()</a></span>
     函数中，使其升序排列。
    </span>
   </dd>

  
  
   <dt id="constant.sort-desc">
    <strong><code>SORT_DESC</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
     <strong><code>SORT_DESC</code></strong> 用在 <span class="function"><a href="function.array-multisort.html" class="function">array_multisort()</a></span>
     函数中，使其降序排列。
    </span>
   </dd>

  
 </dl>

 </p>

 <p class="para"> 排序类型标识：用于各种排序函数
 <dl>
  
   <dt id="constant.sort-regular">
    <strong><code>SORT_REGULAR</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
     <strong><code>SORT_REGULAR</code></strong> 用于对对象进行通常比较。
    </span>
   </dd>

  
  
   <dt id="constant.sort-numeric">
    <strong><code>SORT_NUMERIC</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
     <strong><code>SORT_NUMERIC</code></strong> 用于对对象进行数值比较。
    </span>
   </dd>

  
  
   <dt id="constant.sort-string">
    <strong><code>SORT_STRING</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
    <strong><code>SORT_STRING</code></strong> 用于对对象进行字符串比较。
    </span>
   </dd>

  
  
   <dt id="constant.sort-locale-string">
    <strong><code>SORT_LOCALE_STRING</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
    <strong><code>SORT_LOCALE_STRING</code></strong> 基于当前区域来对对象进行字符串比较。
    </span>
   </dd>

  
  
   <dt id="constant.sort-natural">
    <strong><code>SORT_NATURAL</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
    <strong><code>SORT_NATURAL</code></strong> 用于对元素作为字符串使用“自然排序”（像是 <span class="function"><a href="function.natsort.html" class="function">natsort()</a></span>
    ）比较。
    </span>
   </dd>

  
  
   <dt id="constant.sort-flag-case">
    <strong><code>SORT_FLAG_CASE</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
    <strong><code>SORT_FLAG_CASE</code></strong> 可以跟 <strong><code>SORT_STRING</code></strong> 或者 <strong><code>SORT_NATURAL</code></strong>
     组合（按位或（OR））对字符串进行大小写不敏感排序。从 PHP 8.2.0 开始，只转换 ASCII 字符。
    </span>
   </dd>

  
 </dl>

 </p>

 <p class="para"> 过滤器 flags:
 <dl>
  
   <dt id="constant.array-filter-use-key">
    <strong><code>ARRAY_FILTER_USE_KEY</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
     <strong><code>ARRAY_FILTER_USE_KEY</code></strong> 用于 <span class="function"><a href="function.array-filter.html" class="function">array_filter()</a></span>
     将每个键作为第一个参数传递给指定回调函数。
    </span>
   </dd>

  
  
   <dt id="constant.array-filter-use-both">
    <strong><code>ARRAY_FILTER_USE_BOTH</code></strong> 
    (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">
     <strong><code>ARRAY_FILTER_USE_BOTH</code></strong> 用于 <span class="function"><a href="function.array-filter.html" class="function">array_filter()</a></span>
     将值和键传递给指定回调函数。
    </span>
   </dd>

  
 </dl>

 </p>

 <dl>
  
   <dt id="constant.count-normal">
    <strong><code>COUNT_NORMAL</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.count-recursive">
    <strong><code>COUNT_RECURSIVE</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.extr-overwrite">
    <strong><code>EXTR_OVERWRITE</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.extr-skip">
    <strong><code>EXTR_SKIP</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.extr-prefix-same">
    <strong><code>EXTR_PREFIX_SAME</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.extr-prefix-all">
    <strong><code>EXTR_PREFIX_ALL</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.extr-prefix-invalid">
    <strong><code>EXTR_PREFIX_INVALID</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.extr-prefix-if-exists">
    <strong><code>EXTR_PREFIX_IF_EXISTS</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.extr-if-exists">
    <strong><code>EXTR_IF_EXISTS</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
  
   <dt id="constant.extr-refs">
    <strong><code>EXTR_REFS</code></strong>
     (<span class="type">int</span>)
   </dt>

   <dd>

    <span class="simpara">

    </span>
   </dd>

  
 </dl>

</div>
</div></div></body></html>